Ext.define('appfe.ux.field.DateTime', {
	extend: 'Ext.form.field.Date',
	alias: 'widget.datetimefield',
	requires: ['appfe.ux.picker.DateTime'],
	//Added By Wonght 
	initFormat: "Y-m-d H:i:s",
	createPicker: function () {
		var me = this, format = Ext.String.format;
		return new appfe.ux.picker.DateTime({
			pickerField: me,
			floating: true,
			preventRefocus: true,
			hidden: true,
			minDate: me.minValue,
			maxDate: me.maxValue,
			disabledDatesRE: me.disabledDatesRE,
			disabledDatesText: me.disabledDatesText,
			ariaDisabledDatesText: me.ariaDisabledDatesText,
			disabledDays: me.disabledDays,
			disabledDaysText: me.disabledDaysText,
			ariaDisabledDaysText: me.ariaDisabledDaysText,
			format: me.format,
			showToday: me.showToday,
			startDay: me.startDay,
			minText: format(me.minText, me.formatDate(me.minValue)),
			ariaMinText: format(me.ariaMinText, me.formatDate(me.minValue,
				me.ariaFormat)),
			maxText: format(me.maxText, me.formatDate(me.maxValue)),
			ariaMaxText: format(me.ariaMaxText, me.formatDate(me.maxValue,
				me.ariaFormat)),
			listeners: {
				scope: me,
				select: me.onSelect,
				tabout: me.onTabOut
			},
			keyNavConfig: {
				esc: function () {
					me.inputEl.focus();
					me.collapse();
				}
			}
		});
	},

	onExpand: function () { //modified by wonght for initFormat config
		var value = this.rawDate;

		var pickerValue;
		if (Ext.isDate(value)) {
			pickerValue = value;
		} else {
			if (this.initFormat) {
				var newDateStr = this.formatDate(new Date(), this.initFormat);
				var newDate = this.parseDate(newDateStr);
				pickerValue = newDate;
			} else {
				pickerValue = new Date();
			}
		}
		this.picker.setValue(pickerValue, true);
	}
})
